import { getItemDetails } from '@/services/api/areaTypes';
import type { ProDescriptionsActionType } from '@ant-design/pro-components';
import { PageContainer, ProDescriptions } from '@ant-design/pro-components';
import { useParams } from '@umijs/max';
import { Button, Card } from 'antd';
import { useRef } from 'react';

const AreaTypeDetails: React.FC = () => {
  const { areaToken } = useParams();
  const actionRef = useRef<ProDescriptionsActionType>();
  return (
    <PageContainer>
      <Card bodyStyle={{ padding: '10px' }}>
        <ProDescriptions
          actionRef={actionRef}
          request={async () => {
            const msg = await getItemDetails({
              token: areaToken!,
            });
            return Promise.resolve({
              success: true,
              data: msg,
            });
          }}
          extra={<Button>返回</Button>}
        >
          {/* <ProDescriptions.Item
            dataIndex="imageUrl"
            valueType="image"
            renderText={(text) => IMG_URL + text}
          /> */}
          <ProDescriptions.Item
            dataIndex="token"
            label="Token"
            valueType="text"
            ellipsis={true}
            copyable={true}
          />
          <ProDescriptions.Item
            label="名称"
            dataIndex="name"
            valueType="text"
            ellipsis={true}
            copyable={true}
          />
          <ProDescriptions.Item
            label="说明"
            dataIndex="description"
            valueType="text"
            ellipsis={true}
            copyable={true}
          />
          <ProDescriptions.Item
            label="创建时间"
            dataIndex="createdDate"
            valueType="text"
            ellipsis={true}
            copyable={true}
          />
          <ProDescriptions.Item
            label="更新时间"
            dataIndex="updatedDate"
            ellipsis={true}
            copyable={true}
          />
        </ProDescriptions>
      </Card>
    </PageContainer>
  );
};

export default AreaTypeDetails;
